package oj;

import java.util.Scanner;

/**
 * @author 郝文雪
 * @date 2022/7/20 22:31
 * @Description Test
 */
public class Day22小易的升级之路 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int n=sc.nextInt();
            int a=sc.nextInt();
            int[] arr=new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            for(int i=0;i<arr.length;i++){
                if(a>=arr[i]){
                    a+=arr[i];
                }else{
                    a+=math(a,arr[i]);
                }
            }
            System.out.println(a);
        }
    }
    private static int math(int a,int b){
        int c=0;
        if(a<b){
            c=a;
            a=b;
            b=c;
        }
        c=0;
        while(b!=0){
            c=a%b;
            a=b;
            b=c;
        }
        return a;
    }
}
